<template>
  <el-form :model="detailForm" class="elForm">
    <el-card class="box-card" shadow="never">
      <div slot="header">
        <span>变更基础</span>
      </div>
      <el-row :gutter="20">
        <el-col :span="8">
          <el-form-item label="车架号：">
            <el-input v-if="isEdit" v-model="detailForm.vinNo"></el-input>
            <span v-else>{{ detailForm.vinNo }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="车牌号：">
            <el-input v-if="isEdit" v-model="detailForm.carNo"></el-input>
            <span v-else>{{ detailForm.carNo }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="车型：">
            <el-input v-if="isEdit" v-model="detailForm.modelName"></el-input>
            <span v-else>{{ detailForm.modelName }}</span>
          </el-form-item>

        </el-col>

        <el-col :span="8">
          <el-form-item label="合同禀议号：">
            <el-input v-if="isEdit" v-model="detailForm.contractReportNumber"></el-input>
            <span v-else>{{ detailForm.contractReportNumber }}</span>
          </el-form-item>
        </el-col>


      </el-row>

    </el-card>
  </el-form>
</template>

<script>
export default {
  name: 'alterInfo',//变更基础
  props: {
    value: {
      type: Object,
      default: {}
    },
    state: {
      type: String,
      default: "",
    },
  },
  computed: {
    detailForm: {
      get() {
        let that = this
        const proxy = new Proxy(that.value, {
          get(target, key, value) {
            return Reflect.get(target, key)
          },
          set(target, key, value) {
            that.$emit('input', {...target, [key]: value})
            return true
          }
        })
        return proxy
      }
    },
    labelPosition() {
      if (this.isEdit) {
        return 'top'
      } else {
        return 'right'
      }

    },
    isEdit() {
      let bool;
      switch (this.state) {
        case "write":
          bool = true;
          break;
        case "disabled":
          bool = false;
          break;
        case "readonly":
          bool = false;
          break;
      }
      return false
    },
  },
  watch: {},
  data() {
    return {};
  },
  created() {
  },
  mounted() {
  },
  methods: {},
};
</script>

<style lang="scss" scoped>
@import "@/styles/cwgd/formScss.scss";
</style>


